import Cookies from 'js-cookie'

// token 的变量名
const KEY_TOKEN = 'MIANMIAN_TOKEN'

// 存储 token
export const setToken = token => {
  Cookies.set(KEY_TOKEN, token)
}
// 读取 token
export const getToken = () => {
  return Cookies.get(KEY_TOKEN)
}
// 存储 token
export const removeToken = () => {
  Cookies.remove(KEY_TOKEN)
}

const timeKey = 'mianmian-timestamp-key'

// 获取时间戳
export function getTimeStamp() {
  return Cookies.get(timeKey)
}
// 设置时间戳
export function setTimeStamp() {
  Cookies.set(timeKey, Date.now())
}
